package com.dmcb.common.business.utils;

import org.apache.commons.lang3.StringUtils;

import java.text.NumberFormat;

/**
 * Created by long on 2015/5/9.
 */
public class NumberUtil {

    public static String toPercent(String decimal) {
        if (StringUtils.isBlank(decimal)) {
            return "0";
        }
        NumberFormat num = NumberFormat.getPercentInstance();
        num.setMaximumIntegerDigits(3);
        num.setMaximumFractionDigits(1);
        return num.format(Double.parseDouble(decimal));
    }

}
